package g2.routemaster.gui.actions;

import g2.routemaster.gui.GManager;
import g2.routemaster.gui.wizards.PlayCardWizard;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.jface.wizard.WizardDialog;

public class PlayCardAction extends Action {
   private ApplicationWindow window;
   public PlayCardAction(ApplicationWindow window) {
      setText("Play Card...");
      this.window = window;
   }

   public void run() {
      // Instantiates and initializes the wizard
      PlayCardWizard wizard = new PlayCardWizard();
      wizard.setPlayer(GManager.instance().getGameManager().getTurnManager().getPlayer());
      
      // Instantiates the wizard container with the wizard and opens it
      WizardDialog dialog = new WizardDialog(window.getShell(), wizard);
      dialog.create();
      dialog.open();
   }
}
